package theLibrary;

import Sorts.Books;
import java.util.ArrayList;
import java.util.List;

public class Library {

    public List<bookSelves> getShu_jia() {
        return shu_jia;
    }
//    用一个List放书架
    public final List<bookSelves> shu_jia = new ArrayList<>();

//书架数量
    public  int getBookSelvesNum() {
        return shu_jia.size();
    }

//添加书架
    public void addBookSelf() {
        this.shu_jia.add(new  bookSelves());
    }

//获取一个书架的所有书
    public List<Books> getAllBooksFromA_BookSelf(int index) {
        return shu_jia.get(index).getShu();
    }

//   给一个书架添加一本书
    public void addBookToA_BookSelf(Books book,int index) {
        if (index >= getBookSelvesNum()) {
            return;
        }
        this.shu_jia.get(index).addBook(book);
    }
//    从一个书架移除一本书
    public boolean removeA_Book(Books book,int index) {
        if(index >= getBookSelvesNum()) {
            return false;
        }
        this.shu_jia.get(index).removeBook(book);
        return true;
    }

}
